﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;

namespace FYPDemo
{
    public partial class WebForm1 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                Session["page"] = "home";
                bindVendorAdvertisement("600200");                
            }
        }

        protected void bindVendorAdvertisement(string size)
        {
            DataTable dt = AdvertisementManagement.listVendorAdvertisement(size);

            if (dt.Rows.Count > 0)
            {
                int i = 1;

                foreach (DataRow dtRows in dt.Rows)
                {
                    Image Img = (Image)FindControl("Img" + i);
                    Img.ImageUrl = dtRows[6].ToString();

                    i++;
                }
            }
        }        
    }
}